<template>
  <dl>
    <dt>{{ $t('pageOverview.networkInformation') }}</dt>
    <dd></dd>
    <dt>{{ $t('pageOverview.hostName') }}：</dt>
    <dd v-if="network && network.hostname">
      {{ dataFormatter(network.hostname) }}
    </dd>
    <dt>{{ $t('pageOverview.linkStatus') }}：</dt>
    <dd v-if="network && network.linkStatus">
      {{ dataFormatter(network.linkStatus) }}
    </dd>
    <dt>IP：</dt>
    <dd>
      {{ URL }}
    </dd>
  </dl>
</template>

<script>
import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';

export default {
  name: 'Network',
  mixins: [DataFormatterMixin],
  computed: {
    network() {
      return this.$store.getters['network/globalNetworkSettings'][1];
    },
    URL() {
      return window.location.hostname;
    },
  },
  created() {
    this.$store.dispatch('network/getEthernetData').finally(() => {
      this.$root.$emit('overview-network-complete');
    });
  },
};
</script>
<style scoped>
dl > dt:first-child {
  font-weight: bold;
  font-size: 16px;
  padding-bottom: 20px;
}
dl {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 10px;
  column-gap: 10px;
}
</style>
